import collections
class Solution(object):
    def countPoints(self, rings):
        n = len(rings) // 2
        out = [set() for _ in range(10)]
        for i in range(n):
            out[int(rings[2 * i + 1])].add(rings[2 * i])
        ans = 0
        for i in range(10):
            if len(out[i]) == 3:
                ans += 1
        return ans